package com.example.campsystem.controller;

import com.example.campsystem.entity.CustomApi;
import com.example.campsystem.entity.Guidecategory;
import com.example.campsystem.entity.Guides;
import com.example.campsystem.service.GuidecategoryService;
import com.example.campsystem.service.GuidesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class GuidesController {
    @Autowired
    private GuidesService guidesService;
    @Autowired
    private GuidecategoryService guidecategoryService;
    @GetMapping("/guides")
    public ResponseEntity<CustomApi> getGuides() {
        List<Guides> guidesList = guidesService.getGuidesList();
        CustomApi customApi = new CustomApi();
        customApi.setCode(200);
        customApi.setMsg("success");
        customApi.setData(guidesList);
        return new ResponseEntity<>(customApi, HttpStatus.OK);
    }
    @GetMapping("/guides/categories")
    public ResponseEntity<CustomApi> getGuidesCategories() {
        List<Guidecategory> guidesList = guidecategoryService.getGuidesCategories();
        CustomApi customApi = new CustomApi();
        customApi.setCode(200);
        customApi.setMsg("success");
        customApi.setData(guidesList);
        return new ResponseEntity<>(customApi, HttpStatus.OK);
    }
}
